﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
using System.IO;

namespace cs746
{
    public static class ConfigReader
    {
        public static List<String> ReadConfig(string file)
        {
            //The config file is just a bunch of lines, each with the library path from the current
            //working directory
            List<String> libs = new List<String>();

            StreamReader s = null;
            try
            {
                s = new StreamReader(file);
            }
            catch (Exception)
            {
                Console.WriteLine("Could not find the libraries file.  It must be placed in the same directory as the executable.");
                return libs;
            }

            while (!s.EndOfStream)
            {
                string l = s.ReadLine();
                l = l.Trim();

                if (l.StartsWith("#"))
                    continue;

                FileInfo f1 = new FileInfo(l);

                libs.Add(f1.FullName);
            }

            s.Close();

            return libs;
        }
    }
}
